package cn.wolfcode.crm.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

@Setter
@Getter
public class Member {
    public static final int STATUS_NORMAL = 1;
    public static final int STATUS_LOSE = 0;

    private Long id;

    private Long cardno;

    private int state;

    private String password;

    private String name;

    private String tel;

    private String qq;

    private String email;

    private String address;

    private String hobby;

    private Level level;

    private Integer nick;

    //积分对象
    private Long availablepoint;
    private Long totalpoint;

    private BigDecimal balance;
    //总消费金额
    private BigDecimal totalSpend;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GTM+8")
    private Date birthday;

    //开卡员工,直接用姓名
    private String operator;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GTM+8")
    private Date startdate;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GTM+8")
    private Date deadline;

    public Long getAvailablepoint(){
        if(availablepoint==null){
            return 0L;
        }
        return this.availablepoint;
    }
}